<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>我的笔记 -{$Think.CONFIG.sitename}</title>

    <link href="__PUBLIC__/static/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="__PUBLIC__/static/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/static/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__PUBLIC__/static/css/plugins/summernote/summernote.css" rel="stylesheet">
    <link href="__PUBLIC__/static/css/plugins/summernote/summernote-bs3.css" rel="stylesheet">
    <link href="__PUBLIC__/static/css/animate.min.css" rel="stylesheet">
    <include file="Public/commoncss" />
    <!-- Sweet Alert -->
    <link href="__PUBLIC__/static/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
</head>

<body class="gray-bg top-navigation">
<div id="wrapper">
    <div id="page-wrapper" class="gray-bg">
        <div class="row border-bottom white-bg">
            <include file="Public/header" />
        </div>
        <div class="wrapper wrapper-content">
            <div class="row">
                <div class="col-sm-3">
                    <div class="ibox float-e-margins">
                        <include file="Public/sidenav" />
                    </div>
                </div>
                <div class="col-sm-9 animated fadeInRight">
                    <div class="ibox">
                        <div class="ibox-title">
                            <h5>所有笔记</h5>
                            <div class="ibox-tools">
                                <a href="{:U('add')}" class="btn btn-primary btn-xs">创建新笔记</a>
                            </div>
                        </div>
                        <div class="ibox-content">
                            <div class="row m-b-sm m-t-sm">
                                <div class="col-md-1">
                                    <button type="button" id="loading-example-btn" class="btn btn-white btn-sm" onclick="window.location.href='{:U('Words/index')}'"><i class="fa fa-refresh"></i> 刷新</button>
                                </div>
                                <form action="" method="get">
                                <div class="col-md-11">
                                    <div class="input-group">

                                            <input placeholder="请输入笔记名称" class="input-sm form-control" name="keyword" type="text" value="{$_GET['keyword']}"> <span class="input-group-btn">
                                            <button type="submit" class="btn btn-sm btn-primary"> 搜索</button> </span>

                                    </div>
                                </div>
                                </form>
                            </div>

                            <div class="project-list">

                                <table class="table table-hover">
                                    <tbody>
                                    <volist name="list" id="val" empty="没有找到匹配的记录">
                                        <tr>
                                            <td class="project-status">
                                                <a href="{:U('index')}?source={$val.source}"><span class="label label-primary">{$val.source|getWordSource}</span></a>

                                            </td>
                                            <td class="project-title">
                                                <a href="{:U('view')}?wid={$val.wid}">{$val.title|SearchWords=$_GET['keyword']}</a>
                                                <br>
                                                <small>笔记时间： {$val.time|beenTime}</small>
                                            </td>

                                            <td class="project-actions">
                                                <a href="{:U('view')}?wid={$val.wid}" class="btn btn-white btn-sm"><i class="fa fa-folder"></i> 查看 </a>
                                                <a href="{:U('edit')}?wid={$val.wid}" class="btn btn-white btn-sm"><i class="fa fa-pencil"></i> 编辑 </a>
                                                <a href="javascript:;" class="btn btn-white btn-sm del" val="{$val.wid}"><i class="fa fa-trash"></i> 删除 </a>
                                            </td>
                                        </tr>
                                    </volist>


                                    </tbody>
                                </table>
                                <div class="text-center">
                                    <div class="btn-group">
                                        {$page}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
        <include file="Public/footer" />
    </div>
</div>
<include file="Public/commonjs" />
<script src="__PUBLIC__/static/js/bootstrap.min.js?v=3.3.5"></script>
<script src="__PUBLIC__/static/js/content.min.js?v=1.0.0"></script>
<script src="__PUBLIC__/static/js/plugins/iCheck/icheck.min.js"></script>
<script src="__PUBLIC__/static/js/plugins/summernote/summernote.min.js"></script>
<script src="__PUBLIC__/static/js/plugins/summernote/summernote-zh-CN.js"></script>
<script src="__PUBLIC__/static/js/plugins/sweetalert/sweetalert.min.js"></script>
<script>
    $(document).ready(function() {
        $('.del').click(function () {
            var delid= $(this).attr("val");
            swal({
                title:"您确定删除这个笔记吗",
                text: "删除后将不可以恢复！",
                type: "info",
                showCancelButton: true,
                confirmButtonColor: "#DD6B55",
                cancelButtonText:"取消",
                confirmButtonText: "确定",
                closeOnConfirm: false
            }, function () {
                $.post("{:U('del')}",{wid:delid},function(data){
                    if(data.status !== 'y'){
                        swal('操作失败!',data.info, "warning");
                    }else{
                        window.location.reload();
                    }
                });
            });
        });
    });


</script>

</body>

</html>